CREATE TABLE [dbo].[LostPants](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[ProductionId] [bigint] NOT NULL,
	[SizeId] [bigint] NOT NULL,
	[Quantity] [int] NOT NULL,
	[Date] [datetime] NOT NULL,
	[DateCreated] [datetime] NOT NULL,
	[CreatedBy] [bigint] NULL,
 CONSTRAINT [PK_LostPants] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[LostPants]  WITH CHECK ADD  CONSTRAINT [FK__LostPants__Creat__5F7E2DAC] FOREIGN KEY([CreatedBy])
REFERENCES [dbo].[Users] ([Id])
GO

ALTER TABLE [dbo].[LostPants] CHECK CONSTRAINT [FK__LostPants__Creat__5F7E2DAC]
GO

ALTER TABLE [dbo].[LostPants]  WITH CHECK ADD  CONSTRAINT [FK__LostPants__Produ__5D95E53A] FOREIGN KEY([ProductionId])
REFERENCES [dbo].[Production] ([Id])
GO

ALTER TABLE [dbo].[LostPants] CHECK CONSTRAINT [FK__LostPants__Produ__5D95E53A]
GO

ALTER TABLE [dbo].[LostPants]  WITH CHECK ADD  CONSTRAINT [FK__LostPants__SizeI__5E8A0973] FOREIGN KEY([SizeId])
REFERENCES [dbo].[Sizes] ([Id])
GO

ALTER TABLE [dbo].[LostPants] CHECK CONSTRAINT [FK__LostPants__SizeI__5E8A0973]
GO

ALTER TABLE [dbo].[LostPants] ADD  CONSTRAINT [DF_LostPants_DateCreated]  DEFAULT (getdate()) FOR [DateCreated]
GO


